package com.xhsd.zlong.generatecode.model.impl.mysql;

import com.xhsd.zlong.generatecode.utils.StringUtil;
import com.xhsd.zlong.generatecode.model.IColumn;

public class MysqlColumn implements IColumn{
	public static String c_name="Field";
	
	public static String c_type="Type";
	
	public static String c_comment="Comment";
	
	public static String c_key="Key";
	
	public static String key_pri="PRI";
	
	private String name;
	
	private String javaName;
	
	private String javaNameUpper;
	
	private String type;
	
	private String comment;
	
	private boolean pri=false;
	
	/**
	 * @param name 列名
	 * @param type msyql类型
	 * @param comment 
	 */
	public MysqlColumn(String name,String type,String comment,String key){
		this.setName(name);
		
		this.type=MysqlTypes.getJavaTypeFromMysqlType(type).getSimpleName();
		
		this.comment=comment;
		
		this.pri=key_pri.equalsIgnoreCase(key);
	}
	
	public void setName(String name){
		
		this.name=name;
		
		this.javaName=StringUtil.getJavaName(name);
		
		this.javaNameUpper=StringUtil.upperFirst(name);
	}

	public String getName() {
		return name;
	}

	public String getJavaName() {
		return javaName;
	}

	public String getJavaNameUpper() {
		return javaNameUpper;
	}

	public String getType() {
		return type;
	}

	public String getComment() {
		return comment;
	}

	public boolean isPri() {
		return pri;
	}
	
	
	
	

}
